package com.oocl.im.action.impl;

import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;

import com.oocl.im.action.IAction;
import com.oocl.im.outputstream.NetOutput;
import com.oocl.im.constants.ClientMaintenance;
import com.oocl.im.constants.Constants;
import com.oocl.im.entity.Protocol;

public class ShakeAction implements IAction {
	ObjectOutputStream oos;
	
	public ShakeAction(ObjectOutputStream oos) {
		super();
		this.oos = oos;
	}

	public ObjectOutputStream getOos() {
		return oos;
	}

	public void setOos(ObjectOutputStream oos) {
		this.oos = oos;
	}


	public void execute(Protocol protocol) {

		NetOutput netOutput = new NetOutput(oos);
		Map<String, Object> params =  new HashMap<String, Object>();
		params.put(Constants.FROM,ClientMaintenance.client.getAccount());
		params.put(Constants.TO, ClientMaintenance.currentChatUser);
		params.put(Constants.CONTENT, "shake you!");
		
		protocol = new Protocol(Constants.SHAKE, params);
		System.out.println(protocol);//测试用
		
		netOutput.write(protocol);
		
	}
	
}
